<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="企业名称" prop="companyName">
        <el-input
          style="width: 150px;"
          v-model="queryParams.companyName"
          placeholder="请输入企业名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="客户分类" prop="classification">
        <el-select v-model="queryParams.classification" placeholder="请选择客户分类" style="width: 150px;">
          <el-option label="--请选择--" value="" @keyup="handleQuery"></el-option>
          <el-option label="普通客户" value="普通客户" @keyup="handleQuery"></el-option>
          <el-option label="重要客户" value="重要客户" @keyup="handleQuery"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="客户属性" prop="property">
        <el-select v-model="queryParams.property" placeholder="请选择客户属性" style="width: 150px;">
          <el-option label="--请选择--" value="" @keyup="handleQuery"></el-option>
          <el-option label="新客户" value="新客户" @keyup="handleQuery"></el-option>
          <el-option label="老客户" value="老客户" @keyup="handleQuery"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="签约状态" prop="contract">
        <el-select v-model="queryParams.contract" placeholder="请选择客户属性" style="width: 150px;">
          <el-option label="--请选择--" value="" @keyup="handleQuery"></el-option>
          <el-option label="已签约" value="已签约" @keyup="handleQuery"></el-option>
          <el-option label="未签约" value="未签约" @keyup="handleQuery"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="" prop="all" style="width: 150px;">
        <el-input
          v-model="queryParams.all"
          placeholder="请输入搜索内容"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
<!--
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:enterprise:add']"
        >新增
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:enterprise:edit']"
        >修改
        </el-button>
      </el-col>
-->

      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <!--  客户列表  -->
    <el-table v-loading="loading" :data="enterpriseList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center"/>
      <!--      <el-table-column label="企业id" align="center" prop="companyId"/>-->
      <el-table-column label="企业名称" align="center" prop="companyName" width="200"/>
      <el-table-column label="客户分类" align="center" prop="classification" width="100"/>
      <el-table-column label="客户属性" align="center" prop="property" width="100"/>
      <el-table-column label="省市区" align="center" prop="province" width="250"/>
      <el-table-column label="详细地址" align="center" prop="address" width="250"/>
      <el-table-column label="公司规模" align="center" prop="scale" width="100"/>
      <el-table-column label="联系人" align="center" prop="linkman" width="100"/>
      <el-table-column label="职务" align="center" prop="post" width="100"/>
      <el-table-column label="联系电话" align="center" prop="phone" width="150"/>
      <el-table-column label="是否签约" align="center" prop="contract" width="100"/>
      <el-table-column label="在招岗位" align="center" prop="attract" width="100">
        <template slot-scope="scope">
          <div v-if="scope.row.attract == null">
            0
          </div>
          <div v-if="scope.row.attract != null">
            {{ scope.row.attract }}
          </div>
        </template>
      </el-table-column>
      <el-table-column label="入职人员" align="center" prop="entry" width="100">
        <template slot-scope="scope">
          <div v-if="scope.row.entry == null">
            0
          </div>
          <div v-if="scope.row.entry != null">
            {{ scope.row.entry }}
          </div>
        </template>
      </el-table-column>
      <el-table-column label="保护状态" align="center" prop="protectStatus" width="100">
        <template slot-scope="scope">
          <div v-if="scope.row.protectStatus == '0'">
            保护中
          </div>
          <div v-if="scope.row.protectStatus == '1'">
            无保护
          </div>
        </template>
      </el-table-column>
      <el-table-column label="创建时间" align="center" prop="createTime" width="200">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="创建人" align="center" prop="entry" width="100">
        <template slot-scope="scope">
          <center>{{ scope.row.createName }}</center>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="310">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-s-management"
            @click="getEnte(scope.row.companyId)"
            v-hasPermi="['system:enterprise:query']"
          >企业信息
          </el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 添加或修改【客户】对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" :close-on-click-modal='false' append-to-body>

      <el-form ref="form" :model="form" :rules="rules" label-width="150px">
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="企业名称" prop="companyName">
              <el-input v-model="form.companyName" placeholder="请输入企业名称" style="width: 300px"/>
            </el-form-item>
          </el-col>

          <el-col :span="10">
            <el-form-item label="签约状态" prop="contract">
              <el-select v-model="form.contract" placeholder="请选择客户属性" style="width: 300px">
                <el-option label="--请选择--" value="" @keyup="handleQuery"></el-option>
                <el-option label="已签约" value="已签约" @keyup="handleQuery"></el-option>
                <el-option label="未签约" value="未签约" @keyup="handleQuery"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="联系人" prop="linkman">
              <el-input v-model="form.linkman" placeholder="请输入联系人" style="width: 300px"/>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="职务" prop="post">
              <el-input v-model="form.post" placeholder="请输入职务" style="width: 300px"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="联系电话" prop="phone">
              <el-input v-model="form.phone" placeholder="请输入联系电话" style="width: 300px"/>
            </el-form-item>
          </el-col>

          <el-col :span="10">
            <el-form-item label="客户属性" prop="property">
              <el-select v-model="form.property" placeholder="请选择客户属性" style="width: 300px">
                <el-option label="--请选择--" value="" @keyup="handleQuery"></el-option>
                <el-option label="新客户" value="新客户" @keyup="handleQuery"></el-option>
                <el-option label="老客户" value="老客户" @keyup="handleQuery"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="客户分类" prop="classification">
              <el-select v-model="form.classification" placeholder="请选择客户分类" style="width: 300px">
                <el-option label="--请选择--" value="" @keyup="handleQuery"></el-option>
                <el-option label="普通客户" value="普通客户" @keyup="handleQuery"></el-option>
                <el-option label="重要客户" value="重要客户" @keyup="handleQuery"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="公司规模" prop="scale">
              <el-select v-model="form.scale" placeholder="请选择客户属性" style="width: 300px">
                <el-option label="--请选择--" value="" @keyup="handleQuery"></el-option>
                <el-option label="0-20" value="0-20" @keyup="handleQuery"></el-option>
                <el-option label="20-99" value="20-99" @keyup="handleQuery"></el-option>
                <el-option label="100-500" value="100-500" @keyup="handleQuery"></el-option>
                <el-option label="500-999" value="500-999" @keyup="handleQuery"></el-option>
                <el-option label="1000-5000" value="1000-5000" @keyup="handleQuery"></el-option>
                <el-option label="10000+" value="10000+" @keyup="handleQuery"></el-option>
              </el-select>
            </el-form-item>
          </el-col>

        </el-row>
        <el-row :gutter="20">
          <el-form-item label="省市区" prop="address" placeholder="请选择省市区" @click="">
            <el-col :span="6">
              <el-cascader
                :options="optionss"
                v-model="selectedAddressOptions"
                @change="handleChange"
                clearable
                filterable>
              </el-cascader>
            </el-col>
            <el-col :span="8">
              <el-input v-model="form.address" placeholder="请输入详细地址" style="width: 300px"/>
            </el-col>
            <el-col :span="6">
              <el-button type="primary" style="float: right" @click="addlm()" round>添加备用联系人</el-button>
            </el-col>
          </el-form-item>
        </el-row>
        <el-row :gutter="24">
          <el-col :span="24">
            <el-collapse @change="chageLm">
              <el-form ref="lmform" :model="lmParams" label-width="150px">
                <el-collapse-item :title="'备用联系人'+(index+1)" name="1" v-for="(it, index) in lm" :key="index">

                  <el-row :gutter="20">
                    <el-col :span="10">
                      <el-form-item label="姓名" prop="linkName">
                        <el-input v-model="it.linkName" placeholder="联系人姓名" style="width: 300px"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="10">
                      <el-form-item label="电话" prop="linkPhone">
                        <el-input v-model="it.linkPhone" placeholder="联系人电话" style="width: 300px"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row :gutter="20">
                    <el-col :span="10">
                      <el-form-item label="职位" prop="linkPost">
                        <el-input v-model="it.linkPost" placeholder="联系人职位" style="width: 300px"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-collapse-item>
              </el-form>
            </el-collapse>
          </el-col>
        </el-row>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm(form.companyId)">确认</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>

    </el-dialog>
    <el-dialog :title="title" :visible.sync="linkmanSync" width="1000px" :close-on-click-modal='false' append-to-body>

      <el-form ref="form" :model="linkmanInfo" label-width="150px">
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="联系人" prop="linkName">
              <el-input v-model="linkmanInfo.linkName" placeholder="请输入联系人" style="width: 300px"/>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="职务" prop="linkPost">
              <el-input v-model="linkmanInfo.linkPost" placeholder="请输入职务" style="width: 300px"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="联系电话" prop="linkPhone">
              <el-input v-model="linkmanInfo.linkPhone" placeholder="请输入联系电话" style="width: 300px"/>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="linkmanMit">确认</el-button>
        <el-button @click="linkReset">取 消</el-button>
      </div>

    </el-dialog>
    <!-- 企业详情对话框 itoEnterprise-->
    <el-dialog :title="title" :visible.sync="videoVisibles" width="60%" :close-on-click-modal='false' append-to-body
               border>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          @click="handleUpdate2(itoEnterprise.companyId)"
          v-hasPermi="['system:enterprise:edit']"
        >编辑
        </el-button>
      </el-col>
      <el-descriptions class="margin-top" :column="2" border>
        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              企业名称
            </center>
          </template>
          <center>
            {{ itoEnterprise.companyName }}
          </center>

        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              客户分类
            </center>
          </template>
          <center>
            {{ itoEnterprise.classification }}
          </center>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              客户属性
            </center>
          </template>
          <center>
            {{ itoEnterprise.property }}
          </center>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              公司规模
            </center>
          </template>
          <center>
            {{ itoEnterprise.scale }}
          </center>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              省市区
            </center>
          </template>
          <center>
            {{ itoEnterprise.province }}
          </center>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              详细地址
            </center>
          </template>
          <center>
            {{ itoEnterprise.address }}
          </center>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              联系人
            </center>
          </template>
          <center>{{ itoEnterprise.linkman }}</center>

        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              职务
            </center>

          </template>
          <center>{{ itoEnterprise.post }}</center>

        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              联系电话
            </center>

          </template>
          <center>{{ itoEnterprise.phone }}</center>

        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              是否签约
            </center>
          </template>
          <center>{{ itoEnterprise.contract }}</center>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              创建时间
            </center>
          </template>
          <center>{{ parseTime(itoEnterprise.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</center>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              创建人
            </center>
          </template>
          <center>{{ itoEnterprise.createName }}</center>
        </el-descriptions-item>
      </el-descriptions>

      <el-descriptions :title="'第'+(index+1)+'联系人'" class="margin-top" :column="3" border
                       v-for="(item,index) in itoEnterprise.lmParams">
        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              联系人姓名
            </center>
          </template>
          <center>{{ item.linkName }}</center>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              联系人电话
            </center>
          </template>
          <center>{{ item.linkPhone }}</center>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              联系人职位
            </center>
          </template>
          <center>{{ item.linkPost }}</center>
        </el-descriptions-item>
      </el-descriptions>

    </el-dialog>

    <!-- 岗位列表弹窗   -->
    <el-dialog :title="title" :visible.sync="videoVisibleStaton" width="90%" :close-on-click-modal='false'
               append-to-body>
      <el-form :model="stationList" ref="queryForm" size="small" :inline="true" v-show="showSearch"
               label-width="68px">
        <el-form-item label="" prop="beginTime">
          <el-date-picker clearable
                          v-model="queryStationParams.beginTime"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="开始日期">
          </el-date-picker>
        </el-form-item>

        <el-form-item prop="endTimee">
          <el-date-picker clearable
                          v-model="queryStationParams.endTimee"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="结束日期">
          </el-date-picker>
        </el-form-item>

        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
        <el-form-item prop="companyName">
          <el-input
            v-model="queryStationParams.all"
            placeholder="请输入搜索内容"
            clearable
            @keyup.enter.native="handleQueryStation"
          />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="max" @click="handleQueryStation(queryStationParams.companyId)">搜索</el-button>
          <el-button icon="el-icon-refresh" size="max" @click="resetQueryStation">重置</el-button>
        </el-form-item>
      </el-form>
      <!--      岗位列表-->
      <el-table v-loading="loading" :data="stationList" @selection-change="handleSelectionChange"
                style="width: 100%" max-height="100%">
        <el-table-column type="selection" align="center" width="50"/>
        <el-table-column :show-overflow-tooltip="true" label="岗位名称" align="center" prop="stationName" width="110"/>
        <el-table-column label="岗位等级" align="center" prop="jobGrade" width="100"/>
        <el-table-column label="岗位类型" align="center" prop="stationCategory" width="100"/>
        <el-table-column :show-overflow-tooltip="true" label="企业名称" align="center" prop="companyName" width="200"/>
<!--
        <el-table-column :show-overflow-tooltip="true" label="项目组" align="center" prop="proName" width="120"/>
-->
        <el-table-column label="待初筛" align="center" width="60" prop="cou0">
          <template slot-scope="scope">
          <span v-if="scope.row.cou0 == null">
           0
          </span>
            <span v-if="scope.row.cou0 != null">
           {{ scope.row.cou0 }}
          </span>
          </template>


        </el-table-column>
        <el-table-column label="待面试" align="center" width="60" prop="cou1">
          <template slot-scope="scope">
          <span v-if="scope.row.cou1 == null">
           0
          </span>
            <span v-if="scope.row.cou1 != null">
           {{ scope.row.cou1 }}
          </span>
          </template>

        </el-table-column>
        <el-table-column label="待入职" align="center" width="60" prop="cou2">
          <template slot-scope="scope">
          <span v-if="scope.row.cou2 == null">
           0
          </span>
            <span v-if="scope.row.cou2 != null">
           {{ scope.row.cou2 }}
          </span>
          </template>
        </el-table-column>
        <el-table-column label="待录用" align="center" width="60" prop="cou2">
          <template slot-scope="scope">
          <span v-if="scope.row.cou3 == null">
           0
          </span>
            <span v-if="scope.row.cou3 != null">
           {{ scope.row.cou3 }}
          </span>
          </template>
        </el-table-column>
        <el-table-column label="已入职" align="center" width="60" prop="cou3">
          <template slot-scope="scope">
          <span v-if="scope.row.cou6 == null">
           0
          </span>
            <span v-if="scope.row.cou6 != null">
           {{ scope.row.cou6 }}
          </span>
          </template>
        </el-table-column>
        <el-table-column label="薪资范围" align="center" prop="startMoney" width="100">
          <template slot-scope="scope">
            {{ scope.row.startMoney + '~' + scope.row.endMoney }} K
          </template>
        </el-table-column>

        <el-table-column label="岗位定价(K)" align="center" prop="postPricing" width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.postPricing == null">无</span>
            <span v-if="scope.row.postPricing != null">{{ scope.row.postPricing + 'K' }}</span>
          </template>


        </el-table-column>
        <el-table-column label="负责商务" align="center" prop="createdBy" width="120"/>
        <el-table-column label="招聘人数" align="center" prop="need" width="80"/>
        <el-table-column label="招聘截止" align="center" prop="wokeEndTime" width="100">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.wokeEndTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>

        <el-table-column label="岗位创建时间" align="center" prop="createTime" width="130">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="200" align="center" class-name="small-padding fixed-width" fixed="right">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-share"
              @click="playVideStation(scope.row.stationId)"
              v-hasPermi="['system:station:query']"
            >详情
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total2>0"
        :total="total2"
        :page.sync="queryStationParams.pageNum"
        :limit.sync="queryStationParams.pageSize"
        @pagination="getStationList"
      />
    </el-dialog>
    <!-- 用户列表弹窗   -->
    <el-dialog :title="title" :visible.sync="videoVisibles2" width="80%" :close-on-click-modal='false'
               append-to-body>
      <template>
        <div class="app-container">
          <el-row :gutter="20">
            部门数据
            <el-col :span="4" :xs="24">
              <div class="head-container">
                <el-input
                  v-model="deptName"
                  placeholder="请输入部门名称"
                  clearable
                  size="small"
                  prefix-icon="el-icon-search"
                  style="margin-bottom: 20px"
                />
              </div>
              <div class="head-container">
                <el-tree
                  :data="deptOptions"
                  :props="defaultProps"
                  :expand-on-click-node="false"
                  :filter-node-method="filterNode"
                  ref="tree"
                  default-expand-all
                  highlight-current
                  @node-click="handleNodeClick"
                />
              </div>
            </el-col>
            <!--用户数据-->
            <el-col :span="20" :xs="24">
              <el-form :model="queryUserParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
                       label-width="68px">

                <el-form-item label="用户名称" prop="userName">
                  <el-input
                    v-model="queryUserParams.userName"
                    placeholder="请输入用户名称"
                    clearable
                    style="width: 240px"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
                <el-form-item label="手机号码" prop="phonenumber">
                  <el-input
                    v-model="queryUserParams.phonenumber"
                    placeholder="请输入手机号码"
                    clearable
                    style="width: 240px"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
                <el-form-item label="状态" prop="status">
                  <el-select
                    v-model="queryUserParams.status"
                    placeholder="用户状态"
                    clearable
                    style="width: 240px"
                  >
                    <el-option
                      v-for="dict in dict.type.sys_normal_disable"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
                <el-form-item label="创建时间">
                  <el-date-picker
                    v-model="dateRange"
                    style="width: 240px"
                    value-format="yyyy-MM-dd"
                    type="daterange"
                    range-separator="-"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                  ></el-date-picker>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" icon="el-icon-search" size="mini" @click="handleUserQuery">搜索</el-button>
                  <el-button icon="el-icon-refresh" size="mini" @click="resetUserQuery">重置</el-button>
                </el-form-item>
              </el-form>
              <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">

                <el-table-column type="" v-model="queryUserParams.companyId"/>
                <el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible"/>
                <el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible"
                                 :show-overflow-tooltip="true"/>
                <el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible"
                                 :show-overflow-tooltip="true"/>
                <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible"
                                 :show-overflow-tooltip="true"/>
                <el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber"
                                 v-if="columns[4].visible" width="120"/>
                <el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
                  <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.createTime) }}</span>
                  </template>
                </el-table-column>
                <el-table-column
                  label="操作"
                  align="center"
                  width="160"
                  class-name="small-padding fixed-width"
                >
                  <template slot-scope="scope" v-if="scope.row.userId !== 1">
                    <el-button
                      size="mini"
                      type="text"
                      icon="el-icon-edit"
                      @click="handleUserUpdate(scope.row.nickName,scope.row.userId,queryUserParams.companyId)"
                      v-hasPermi="['system:enterprise:edit']"
                    >分配客户
                    </el-button>
                    <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)"
                                 v-hasPermi="['system:user:resetPwd', 'system:user:edit']">
                    </el-dropdown>
                  </template>
                </el-table-column>
              </el-table>

              <pagination
                v-show="total3>0"
                :total="total3"
                :page.sync="queryUserParams.pageNum"
                :limit.sync="queryUserParams.pageSize"
                @pagination="getUserList(queryUserParams.companyId)"
              />
            </el-col>
          </el-row>

        </div>
      </template>
    </el-dialog>

    <!-- 岗位详情对话框 -->
    <el-dialog :title="title" :visible.sync="videoStation" width="90%" :close-on-click-modal='false' append-to-body
               border>
      <el-button
        size="mini"
        type="text"
        style="float:left"
        icon="el-icon-edit"
        @click="handleUpdate1(ItoStation.stationId)"
        v-hasPermi="['system:station:edit']"
      >编辑
      </el-button>

      <el-descriptions class="margin-top" :column="4" border>


        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              岗位名称
            </center>
          </template>
          <center>
            {{ ItoStation.stationName }}
          </center>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              企业名称
            </center>
          </template>
          <center>
            {{ ItoStation.companyName }}
          </center>
        </el-descriptions-item>

       <!-- <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              项目组
            </center>
          </template>
          <center>
            {{ ItoStation.proName }}
          </center>
        </el-descriptions-item>-->
        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              负责商务
            </center>
          </template>
          <center>{{ ItoStation.createdBy }}</center>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              发布日期
            </center>
          </template>
          <center>{{ parseTime(ItoStation.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</center>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              学历要求
            </center>
          </template>
          <center>{{ ItoStation.education }}</center>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              岗位等级
            </center>
          </template>
          <center>
            {{ ItoStation.jobGrade }}
          </center>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              用工时长
            </center>
          </template>
          <center>{{ ItoStation.endTime }}</center>
        </el-descriptions-item>

        <!--        <span v-if="interview==true">-->
        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              工资薪酬(K)
            </center>
          </template>
          <center v-if="ItoStation.interview == 0 ">{{ ItoStation.startMoney }}—{{ ItoStation.endMoney }}K</center>
          <center v-if="ItoStation.interview == 1 ">面议</center>

        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              招聘人数
            </center>
          </template>
          <center>{{ ItoStation.need }}</center>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              招聘截止日期
            </center>
          </template>
          <center>{{ parseTime(ItoStation.wokeEndTime, '{y}-{m}-{d}') }}</center>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              省市区
            </center>
          </template>
          <center>
            {{ ItoStation.province }}
          </center>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              详细地址
            </center>
          </template>
          <center>
            {{ ItoStation.wokeAddress }}
          </center>
        </el-descriptions-item>


      </el-descriptions>
      <el-descriptions class="margin-top" direction="vertical" :column="2" border>

        <el-descriptions-item :span="4">
          <template slot="label">
            <i class="el-icon-user"></i>
            岗位职责
          </template>
          <span v-html="ItoStation.jobDescription"></span>
        </el-descriptions-item>


        <el-descriptions-item :span="4">
          <template slot="label">
            <i class="el-icon-user"></i>
            岗位要求
          </template>
          <span v-html="ItoStation.remarks"></span>
        </el-descriptions-item>
      </el-descriptions>
      <br>
    </el-dialog>

    <!--入职人员-->
    <el-dialog :title="title" :visible.sync="videoVisibles0" width="90%" :close-on-click-modal='false' append-to-body
               border>
      <span style="padding-left: 20px;font-size: 20px;color:#673ab7;">投递记录</span>&nbsp;&nbsp;
      <el-radio-group v-model="radio1">
        <el-radio-button label="全部" @click.native="aaa('200')"></el-radio-button>
        <el-radio-button label="待初筛" @click.native="aaa(0)"></el-radio-button>
        <el-radio-button label="待面试" @click.native="aaa(1)"></el-radio-button>
        <el-radio-button label="待入职" @click.native="aaa(2)"></el-radio-button>
        <el-radio-button label="已入职" @click.native="aaa(3)"></el-radio-button>
      </el-radio-group>
      <el-button type="primary" style="float: right;margin-right: 20px;" @click="downloadAll">批量下载</el-button>
      <br>
      <hr>
      <el-table v-loading="loading" :data="auitvoList"
                ref="multipleTable"
                tooltip-effect="dark"
                style="width: 100%"
                @selection-change="getIds">
        <el-table-column

          align="center"
          type="selection"
          width="55">
        </el-table-column>
        <el-table-column label="状态" align="center" prop="isFirst">
          <template slot-scope="scope">

          <span v-if="scope.row.isFirst == 0">
            <el-tag type="info">待初筛</el-tag>
          </span>
            <span v-if="scope.row.isFirst == 1">
             <el-tag type="primary">待面试</el-tag>
          </span>
            <span v-if="scope.row.isFirst == 2">
             <el-tag type="warning">待入职</el-tag>
          </span>
            <span v-if="scope.row.isFirst == 3">
             <el-tag type="danger">已入职</el-tag>
          </span>
          </template>

        </el-table-column>
        <el-table-column label="创建时间" align="center" prop="createTime" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="创建人" align="center" prop="createName"/>
        <el-table-column label="简历名称" align="center" prop="resumeName"/>
        <el-table-column label="简历电话" align="center" prop="phone"/>
        <el-table-column label="岗位名称" align="center" prop="stationName"/>
        <el-table-column label="岗位电话" align="center" prop="companyPhone"/>
        <el-table-column label="岗位邮箱" align="center" prop="companyMailbox"/>
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              @click="download(scope.row.resumeId)"
              v-hasPermi="['system:station:edit']"
            >下载简历
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total1>0"
        :total="total1"
        :page.sync="queryParam.pageNum"
        :limit.sync="queryParam.pageSize"
        @pagination="aaa()"
      />
    </el-dialog>
    <!-- 添加或修改【岗位】对话框 -->
    <el-dialog :title="title" :visible.sync="openStation" width="70%" :close-on-click-modal='false' append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="招聘企业" prop="companyId">
              <template>
                <el-select v-model="value" filterable placeholder="请选择">
                  <el-option
                    v-for="item in options"
                    :key="item.companyId"
                    :label="item.companyName"
                    :value="item.companyId">
                  </el-option>
                </el-select>
              </template>
            </el-form-item>

          </el-col>
          <el-col :span="12">
            <el-form-item label="岗位名称" prop="stationName">
              <el-input v-model="form.stationName" placeholder="请输入岗位名称"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="学历要求" prop="education">
              <el-select v-model="form.education" placeholder="请选择学历" style="width: 100%">
                <el-option label="请选择" value=""></el-option>
                <el-option label="不限" value=""></el-option>
                <el-option label="专科" value="大专"></el-option>
                <el-option label="本科" value="本科"></el-option>
                <el-option label="硕士" value="硕士"></el-option>
                <el-option label="博士" value="博士"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="工作经验" prop="jobGrade">
              <template>
                <el-radio-group v-model="form.jobGrade">
                  <el-radio-button label="初级"></el-radio-button>
                  <el-radio-button label="中级"></el-radio-button>
                  <el-radio-button label="高级"></el-radio-button>
                </el-radio-group>
              </template>
            </el-form-item>

          </el-col>
        </el-row>

        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="招聘人数" prop="need">
              <el-input-number v-model="form.need" :min="1" :max="999" label="请输入需招人数"></el-input-number>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="用工时长(月)" prop="endTime">
              <el-input-number v-model="form.endTime" :min="1" :max="120" label="请输入需招人数"></el-input-number>
            </el-form-item>
          </el-col>

        </el-row>


        <el-row :gutter="24">
          <el-col :span="12">


            <!--            <span v-if="interview">-->

            <!--            </span>-->
            <!--            <span v-else>-->
            <el-form-item label="最低工资(K)" prop="startMoney">
              <el-input v-model="form.startMoney" placeholder="请输入最低工资(K)" style="width: 150px"/>
              —
              <el-input v-model="form.endMoney" placeholder="请输入最高工资(K)" style="width: 160px"/>&nbsp;&nbsp;
              <el-checkbox v-model="checked">面议</el-checkbox>
            </el-form-item>
            <!--            </span>-->
            <!--            @click.native="sss()"-->
          </el-col>


          <el-col :span="12">
            <el-form-item label="招聘截止时间" prop="wokeEndTime">
              <el-date-picker clearable
                              style="width: 100%"
                              v-model="form.wokeEndTime"
                              type="date"
                              value-format="yyyy-MM-dd HH:mm:ss"
                              placeholder="请选择招聘截止时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="24">
          <el-col :span="12">

            <el-form-item label="省 市 区" prop="province" placeholder="请选择省市区" style="width: 780px;">
              <el-col :span="8">

                <el-cascader
                  size="large"
                  :options="optionss"
                  v-model="selectedAddressOptions"
                  @change="handleChange">
                </el-cascader>

              </el-col>
              <el-col :span="4">
                <el-input v-model="form.wokeAddress" placeholder="请输入详细地址" style="width: 300px"/>
              </el-col>
            </el-form-item>


          </el-col>
        </el-row>


        <el-form-item label="岗位职责" prop="jobDescription">
          <el-input v-model="form.jobDescription" type="textarea" placeholder="请输入岗位职责" autosize/>
        </el-form-item>

        <el-form-item label="岗位要求" prop="remarks">
          <el-input v-model="form.remarks" type="textarea" placeholder="请输入" autosize/>
        </el-form-item>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormStation">确 定</el-button>
        <el-button @click="cancelStation">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {regionData, CodeToText, TextToCode} from 'element-china-area-data'
import {
  listEnterprise,
  getEnterprise,
  delEnterprise,
  addEnterprise,
  updateEnterprise,
  getEnte,
  listStation,
  getStation, getStationList, resumeList,
  AddLinkMan
} from "@/api/system/enterprise_public";
import {listAuitvo} from "@/api/system/auitvo";
import {addAuit, getResume, listResume} from "@/api/system/resume";
import {addStation, eliminate, getStationResume, updateStation} from "@/api/system/station";
import log from "@/views/monitor/job/log";
import {
  listUser,
  getUser,
  delUser,
  addUser,
  updateUser,
  resetUserPwd,
  changeUserStatus,
  deptTreeSelect
} from "@/api/system/user";
import {getToken} from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {listDept} from "@/api/system/dept";

export default {
  name: "Enterprise",
  dicts: ['sys_normal_disable', 'sys_user_sex'],
  components: {Treeselect},
  data() {
    return {
      // 部门树选项
      deptOptions: undefined,
      // 部门名称
      deptName: undefined,
      // 岗位选项
      postOptions: [],
      // 表单参数
      formUser: {},
      defaultProps: {
        children: "children",
        label: "label"
      },
      // 列信息
      columns: [
        {key: 0, label: `用户编号`, visible: true},
        {key: 1, label: `用户名称`, visible: true},
        {key: 2, label: `用户昵称`, visible: true},
        {key: 3, label: `部门`, visible: true},
        {key: 4, label: `手机号码`, visible: true},
        {key: 5, label: `状态`, visible: true},
        {key: 6, label: `创建时间`, visible: true}
      ],
      companyIddd: '',
      companyId1: '',
      dateRange: '',

      lm: [],
      lmParams: {},
      value: '',
      options: '',
      radio1: '全部',
      isFirst: '',
      checked: false,
      auitvoList: [],
      resIds: [],
      sId: null,
      //省市区
      optionss: regionData,
      selectedAddressOptions: [],

      xxx: "200",


      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      total1: 0,
      total2: 0,
      total3: 0,
      // 【请填写功能名称】表格数据
      enterpriseList: [],
      // 岗位表格数据
      stationList: [],
      //用户列表数据
      UserList: [],
      userList:null,
      // 用户查询参数
      queryUserParams: {
        pageNum: 1,
        pageSize: 10,
        userName: undefined,
        phonenumber: undefined,
        status: undefined,
        deptId: undefined,
        companyId: null,
        Jb: null

      },
      Dept:{
        Jb:null
      },
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      linkmanSync: false,
      open: false,
      openStation: false,
      videoVisibles: false,
      videoVisibleStaton: false,
      videoStation: false,
      videoVisibleResume: false,
      videoVisibleB: false,
      videoVisibles0: false,
      videoVisibles2: false,

// 岗位查询参数
      queryStationParams: {
        pageNum: 1,
        pageSize: 10,
        companyId: null,

        stationName: null,
        stationCategory: null,
        postPricing: null,
        jobGrade: null,
        experience: null,
        jobDescription: null,
        education: null,
        recruited: null,
        need: null,
        companyName: null,
        province: null,
        wokeAddress: null,
        companyPhone: null,
        companyMailbox: null,
        endTime: null,
        salaryRange: null,
        remarks: null,
        companyWelfare: null,
        createTime: null,
        createdBy: null,
        updateTime: null,
        updatedBy: null,
        wokeEndTime: null,
        startMoney: null,
        endMoney: null,
        beginTime: null,
        endTimee: null,
        status: null,
        cou0: null,
        cou1: null,
        cou2: null,
        cou3: null,
        all: null,
        isDelete: null
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        companyName: null,
        classification: null,
        property: null,
        province: null,
        address: null,
        scale: null,
        linkman: null,
        post: null,
        phone: null,
        contract: null,
        status: null,
        isDelete: null,
        protectStatus: '1',
        all: null
      },
      //详情查询
      itoEnterprise: {
        companyId: null,
        companyName: null,
        classification: null,
        property: null,
        province: null,
        address: null,
        scale: null,
        linkman: null,
        post: null,
        phone: null,
        contract: null,
        createBy: null,
        createName: null,
        createTime: null,
        updateBy: null,
        updateName: null,
        updateTime: null,
        status: null,
        isDelete: null,
        protectStatus: null,
      },

      //查询推送表参数
      queryParamsAuitvo: {
        pageNum: 1,
        pageSize: 10,
        isFirst: 1,
        stationSecond: null,
        resumeName: null,
        phone: null,
        companyName: null,
        stationName: null,
        companyPhone: null,
        companyMailbox: null,
        query: null,
        beginTime: null,
        endTime: null,
        imgPath: null
      }, //查询推送表参数
      queryParam: {
        pageNum: 1,
        pageSize: 10,
        companyId: null,
        isFirst: null,
        companyName: null,
        classification: null,
        property: null,
        province: null,
        address: null,
        scale: null,
        linkman: null,
        post: null,
        phone: null,
        contract: null,
        createBy: null,
        createName: null,
        createTime: null,
        updateBy: null,
        updateName: null,
        updateTime: null,
        status: null,
        isDelete: null,
        protectStatus: null,

      },


      // 岗位详情
      ItoStation: {
        stationId: null,
        stationName: null,
        stationCategory: null,
        jobGrade: null,
        experience: null,
        jobDescription: null,
        education: null,
        recruited: null,
        need: null,
        companyName: null,
        province: null,
        wokeAddress: null,
        companyPhone: null,
        companyMailbox: null,
        endTime: null,
        salaryRange: null,
        remarks: null,
        companyWelfare: null,
        createTime: null,
        createdBy: null,
        updateTime: null,
        updatedBy: null,
        wokeEndTime: null,
        startMoney: null,
        endMoney: null,
        status: null,
        interview: null,
        isDelete: null
      },
      // 查询简历参数
      queryResumeParams: {
        pageNum: 1,
        pageSize: 5,
        resumeId: null,
        resumeName: null,
        sex: null,
        age: null,
        imgPath: null,
        education: null,
        phone: null,
        workyear: null,
        mailbox: null,
        expectStation: null,
        expectWage: null,
        workplace: null,
        professionalSkill: null,
        workeUndergo: null,
        projectUndergo: null,
        educationalBackground: null,
        selfEvaluate: null,
        status: null,
        isDelete: 0,
        lowAge: undefined,
        tallAge: undefined,
        lowWage: undefined,
        tallWage: undefined,
        lowWorkyear: undefined,
        tallWorkyear: undefined
      },
      queryDeptParams: {
        deptName: undefined,
        status: undefined,
        Jb: 1
      },
      // 查询简历参数2
      itoResume: {
        resumeId: null,
        resumeName: null,
        sex: null,
        age: null,
        imgPath: null,
        education: null,
        phone: null,
        workyear: null,
        mailbox: null,
        expectStation: null,
        expectWage: null,
        workplace: null,
        professionalSkill: null,
        workeUndergo: null,
        projectUndergo: null,
        educationalBackground: null,
        selfEvaluate: null,
        status: null,
        isDelete: 0,

      },

      linkmanInfo: {},
      /*企业id*/
      companyIdd: null,
      // 表单参数
      form: {lmParams: []},
      middle: {},
      // 表单校验
      rules: {
        companyName: [
          {required: true, message: '公司名称不能为空', trigger: 'blur'}
        ],
        classification: [
          {required: true, message: '客户分类不能为空', trigger: 'blur'}
        ],
        property: [
          {required: true, message: '客户属性不能为空', trigger: 'blur'}
        ],
        province: [
          {required: true, message: '省市区不能为空', trigger: 'blur'}
        ],
        address: [
          {required: true, message: '公司详细地址不能为空', trigger: 'blur'}
        ],
        scale: [
          {required: true, message: '公司规模不能为空', trigger: 'blur'}
        ],
        linkman: [
          {required: true, message: '联系人不能为空', trigger: 'blur'}
        ],

        post: [
          {required: true, message: '职务不能为空', trigger: 'blur'}
        ],
        phone: [
          {required: true, message: '电话不能为空', trigger: 'blur'},
          {pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur"}
        ],
        contract: [
          {required: true, message: '是否签约不能为空', trigger: 'blur'}
        ]
      }
    };
  },
  watch: {
    // 根据名称筛选部门树
    deptName(val) {
      this.$refs.tree.filter(val);
    }
  },
  created() {
    this.getList();
  },
  methods: {
    chageLm(item) {
      console.log(item)
    },
    addlm() {
      this.lm.push(this.lmParams)
      this.lmParams = {}
    },

    linkmanMit() {
      AddLinkMan(this.linkmanInfo).then(res => {
        console.log(res)
      })
    },
    insertLinkman() {
      this.linkmanSync = true
    },
    linkReset() {
      this.linkmanSync = false;
      this.linkmanInfo = {}
    },
    //省市区
    handleChangeS(value) {
      //我们选择地址后，selectedAddressOptions 会保存对应的区域码，
      //例如北京的区域码为'110000'
      //我们要取出区域码对应的汉字，就需要用CodeToText(区域码)进行输出
      var name = ''
      this.selectedAddressOptions.map(item => name += CodeToText[item] + '/')
      this.form.province = name;//更新表单的数据，以便保存更新
    },
    handleChange(value) {
      //我们选择地址后，selectedAddressOptions 会保存对应的区域码，
      //例如北京的区域码为'110000'
      //我们要取出区域码对应的汉字，就需要用CodeToText(区域码)进行输出
      var name = ''
      this.selectedAddressOptions.map(item => name += CodeToText[item] + '/')
      this.form.province = name;//更新表单的数据，以便保存更新
    },
    /** 根据企业id查询名下岗位列表 */
    getStationList(companyId) {
      this.queryStationParams.companyId = companyId
      getStationList(this.queryStationParams).then(response => {
        console.log(response)
        this.stationList = response.rows;
        this.total2 = response.total;
      });
      this.loading = false;
    },

    /** 查询【客户】列表 */
    getList() {
      this.loading = true;
      listEnterprise(this.queryParams).then(response => {
        this.enterpriseList = response.rows;
        this.total = response.total;
      });
      this.loading = false;
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.selectedAddressOptions = []
      this.form = {
        companyId: null,
        companyName: null,
        classification: null,
        property: null,
        address: null,
        scale: null,
        linkman: null,
        post: null,
        phone: null,
        contract: null,
        createBy: null,
        createName: null,
        createTime: null,
        updateBy: null,
        updateName: null,
        updateTime: null,
        status: null,
        isDelete: null,
        all: null,
        lmParams: []
      };
      this.lm = [];
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 搜索按钮操作 */
    handleQueryStation(companyId) {
      this.queryStationParams.pageNum = 1;
      this.getStationList(companyId);
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams = {}
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 重置按钮操作 */
    resetQueryStation(companyId) {
      this.queryStationParams = {};
      companyId = this.companyIdd
      this.resetForm("queryForm");
      this.handleQueryStation(companyId);
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.companyId)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加企业";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const companyId = row.companyId || this.ids
      getEnterprise(companyId).then(response => {
        this.form = response.data;
        this.open = true;
        var addressStr = new Array(); //定义一数组
        addressStr = (this.form.province).split("/"); //字符分割
        this.selectedAddressOptions = TextToCode[addressStr[0]][addressStr[1]][addressStr[2]].code;
        this.title = "修改企业";
      });
    }, handleUpdate2(companyId) {
      this.reset();
      getEnterprise(companyId).then(response => {
        this.form = response.data;
        this.open = true;
        var addressStr = new Array(); //定义一数组
        addressStr = (this.form.province).split("/"); //字符分割
        this.selectedAddressOptions = TextToCode[addressStr[0]][addressStr[1]][addressStr[2]].code;
        this.title = "修改企业";
      });
    },
    /** 客户提交按钮 */
    submitForm(companyId) {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.companyId != null) {
            updateEnterprise(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getEnte(companyId);
              this.getList();
            });
          } else {
            this.form.lmParams = this.lm
            addEnterprise(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.lm = [];
              this.getList();
            });
          }
        }
      });
    },


    /** 删除按钮操作 */
    handleDelete(row) {
      const companyIds = row.companyId || this.ids;
      this.$modal.confirm('是否确认删除【请填写功能名称】编号为"' + companyIds + '"的数据项？').then(function () {
        return delEnterprise(companyIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/enterprise/export', {
        ...this.queryParams
      }, `enterprise_${new Date().getTime()}.xlsx`)
    },

    /** 岗位详情按钮操作 */
    //点击按钮时,触发弹出效果
    playVideStation(stationId) {
      var isFirst = '200';
      this.sId = stationId;
      //触发点击时,让其显示
      getStationResume(stationId, isFirst).then(response => {
        this.auitvoList = response.data;
      });
      getStation(stationId).then(response => {
        this.ItoStation = response.data;
        this.videoStation = true
        this.title = "岗位详情";
      });
    },

    /** 客户列表后的岗位按钮操作 */
    playVideo(companyId) {
      //触发点击时,让其显示
      this.companyIdd = companyId
      this.queryStationParams.companyId = companyId
      this.videoVisibleStaton = true
      this.title = "岗位列表"
      this.getStationList(companyId)
    },

    /** 客户详情按钮操作 */
    //点击按钮时,触发弹出效果
    getEnte(companyId) {
      getEnte(companyId).then(response => {
        this.itoEnterprise = response.data;
        //触发点击时,让其显示
        this.videoVisibles = true
        this.title = "企业详情"
      });
    },


    /*文件下载*/
    download(resumeId) {
      this.$download.zip(resumeId)
    },
    downloadAll() {
      this.$download.zip(this.resIds)
    },
    getIds(val) {
      this.resIds = val.map(item => item.resumeId);
    },

    /** 岗位详情页修改按钮操作 */
    handleUpdate1(stationId) {
      this.reset();
      this.showitem = false
      //const stationId = this.sId
      getStation(stationId).then(response => {
        if (response.data.interview == '1') {
          this.checked = true;
        }
        if (response.data.interview == '0') {
          this.checked = false;
        }
        this.form = response.data;
        this.openStation = true;
        var addressStr = new Array(); //定义一数组
        addressStr = (this.form.province).split("/"); //字符分割
        this.selectedAddressOptions = TextToCode[addressStr[0]][addressStr[1]][addressStr[2]].code;
        this.title = "修改岗位信息";
        this.getListStation();
      });
    },

    /** 查询 简历 列表 */
    getResumeList() {
      this.loading = true;
      listResume(this.queryResumeParams).then(response => {
        this.resumeList = response.rows;
        this.total = response.total;
      });
      this.loading = false;
    },
    /** 搜索按钮操作 */
    handleQueryResume() {
      this.queryParams.pageNum = 1;
      this.getResumeList();
    },
    /** 重置简历按钮操作 */
    resetQueryResume() {
      this.queryResumeParams = {}
      this.resetForm("queryForm");
      this.handleQueryResume();
    },

    /** 简历详情按钮操作 */
    //点击按钮时,触发弹出效果
    playVideoB(resumeId) {
      getResume(resumeId).then(response => {
        this.itoResume = response.data;
        this.videoVisibleB = true
        this.title = "简历详情"
      });
    },

    /** 简历推送添加 */
    addAuits(resumeId) {
      var stationId = this.stationId
      addAuit(resumeId, stationId).then(response => {
        this.$modal.msgSuccess("推送成功");
        this.open = false;
        this.getResumeList()
        this.videoVisible = true
      });
    },
    /** 岗位提交按钮 */
    submitFormStation() {
      this.form.companyId = this.value
      if (this.checked == false) {
        this.form.interview = '0'
      }
      if (this.checked == true) {
        this.form.interview = '1'
      }
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.stationId != null) {
            updateStation(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.openStation = false;
              this.getStationList(this.companyIdd);
            });
          } else {
            addStation(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.openStation = false;
              this.getStationList(this.companyIdd);
            });
          }
        }
      });
    },
    // 取消按钮
    cancelStation() {
      this.openStation = false;
      this.reset();
    },

    /** 岗位淘汰按钮操作 */
    handleeliminate(stationId) {
      const stationIds = stationId || this.ids;
      this.$modal.confirm('是否确认淘汰该岗位？').then(function () {
        return eliminate(stationIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("淘汰成功");
      }).catch(() => {
      });
    },
    /** 查询推送表列表 */
    getListAuitvo(companyId) {
      this.videoVisibles0 = true;
      this.queryParam.companyId = companyId
      this.queryParam.isFirst = this.xxx;
      this.radio1 = '全部';
      resumeList(this.queryParam).then(response => {
        this.auitvoList = response.rows;
        this.total1 = response.total;
        this.loading = false;
      });
    },


    aaa(xxx) {
      if (xxx != null) {
        this.queryParam.isFirst = xxx
      }

      resumeList(this.queryParam).then(response => {
        this.auitvoList = response.rows;
        this.total1 = response.total;
      });
    },
    /** 查询用户列表 */
    getUserList(companyId) {
      if (companyId == null){
        companyId = this.companyId1
      }
      this.companyId1 = companyId;
      this.queryUserParams.companyId = companyId
      this.getDeptTree(companyId);
      this.getConfigKey("sys.user.initPassword").then(response => {
        this.initPassword = response.msg;
      });
      this.videoVisibles2 = true;
      this.loading = true;
      /*this.queryUserParams.Jb=1;*/

      listUser(this.addDateRange(this.queryUserParams)).then(response => {
          this.UserList.companyId = companyId;
          this.userList = response.rows;
          this.total3 = response.total;

        }
      )
      this.loading = false;
    },

    /** 查询部门下拉树结构 */
    getDeptTree(companyId) {
      deptTreeSelect().then(response => {
        this.deptOptions = response.data;
      });
      if (this.companyId1 == null) {
        this.companyId1 = companyId
      }

    },
    /** 分配用户修改 */
    handleUserUpdate(userName, userId) {
      this.queryParam.companyId = this.companyId1
      this.queryParam.createName = userName
      this.queryParam.createBy = userId
      this.queryParam.protectStatus = '0'
      this.$confirm('是否确认分配该客户?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        updateEnterprise(this.queryParam).then(response => {
          this.$message({
            type: 'success',
            message: '分配成功'
          });
          this.open = false;
          this.videoVisibles2 = false;
          this.getList()
        });
        this.loading = false;
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消分配'
        });
      });
    },
    // 筛选节点
    filterNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
    },
    // 节点单击事件
    handleNodeClick(data) {
      this.queryUserParams.deptId = data.id;
      this.handleUserQuery(data.id);
    },
    // 用户状态修改
    handleStatusChange(row) {
      let text = row.status === "0" ? "启用" : "停用";
      this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗？').then(function () {
        return changeUserStatus(row.userId, row.status);
      }).then(() => {
        this.$modal.msgSuccess(text + "成功");
      }).catch(function () {
        row.status = row.status === "0" ? "1" : "0";
      });
    },
    // 取消按钮
    cancel2() {
      this.open = false;
      this.reset2();
    },
    // 表单重置
    reset2() {
      this.form = {
        userId: undefined,
        deptId: undefined,
        userName: undefined,
        nickName: undefined,
        password: undefined,
        phonenumber: undefined,
        email: undefined,
        sex: undefined,
        status: "0",
        remark: undefined,
        postIds: [],
        roleIds: []
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleUserQuery(deptId) {
      this.queryUserParams.pageNum = 1;
      this.getUserList(this.companyId1);
    },
    /** 重置按钮操作 */
    resetUserQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleUserQuery();
    },

    // 更多操作触发
    handleCommand(command, row) {
      switch (command) {
        case "handleResetPwd":
          this.handleResetPwd(row);
          break;
        case "handleAuthRole":
          this.handleAuthRole(row);
          break;
        default:
          break;
      }
    },
  }
};
</script>
